package saladi.apps.ajax.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;


/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Application implements EntryPoint {

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() { 
	  
	// source -  http://www.java2s.com/Code/Java/GWT/UsingDockPanel.htm
	    
     // Page Contents for Tabs
     String contentForFirstTab = "First Tab's Page Content";
     String contentForSecondTab = "Second Tab's Page Content<br/>PAGE WIDTH<br/>KEEPS<br/>GROWING BASED ON TEXT ADDED<br/>";
     String contentForThirdTab = "Third Tab's Page Content <br/>DECREASED BECAUSE OF LESS CONTENT";
     String contentForFourthTab = "Fourth Tab's Page Content<br/>PAGE WIDTH<br/>ALTERED<br/>AGAIN BECAUSE OF<br/> MORE TEXT ADDED<br/>";
     String contentForFifthTab = "Fifth Tab's Page Content"; 
	  
     // Panel to hold all widgets 
     DockPanel dock = new DockPanel();
     dock.setSpacing(4);
     dock.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
     
     // Four Widgets - Header, Footer and TabMenu with Page Content
     HorizontalPanel header = new HorizontalPanel(); 
     TabPanel tabMenu = new TabPanel();
     FlowPanel tab;
     HorizontalPanel footer = new HorizontalPanel();
     
     //Header and Footer settings
     header.add(new HTML("Header"));
     header.setSize("900px", "50px");
     header.setBorderWidth(1);
     footer.add(new HTML("Footer"));
     footer.setSize("900px", "50px");
     footer.setBorderWidth(1);   
     
     //TabMenu and tab settings
     tab = new FlowPanel();
     tab.add(new HTML(contentForFirstTab));
     tabMenu.add(tab,"Tab1");
     tab = new FlowPanel();
     tab.add(new HTML(contentForSecondTab));
     tabMenu.add(tab,"Tab2");
     tab = new FlowPanel();
     tab.add(new HTML(contentForThirdTab));
     tabMenu.add(tab,"Tab3");
     tab = new FlowPanel();
     tab.add(new HTML(contentForFourthTab));
     tabMenu.add(tab,"Tab4");
     tab = new FlowPanel();
     tab.add(new HTML(contentForFifthTab));
     tabMenu.add(tab,"Tab5");

     // positioning the widgets in the dock(i.e, dock = browser)
     dock.add(header, DockPanel.NORTH);
     dock.add(tabMenu, DockPanel.NORTH);
     dock.add(tab, DockPanel.CENTER);
     dock.add(footer, DockPanel.SOUTH);

     // Add the content to html page
     RootPanel.get().add(dock);
  }
}
